aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/(app)/redeem/[redeemcode]/+server.js
blob: c19901128bc79c6ff87e5455aafa1cd21d747495 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
import { redirect } from '@sveltejs/kit';
import { auth, post } from "$lib/utils";

export async function GET({ cookies, locals, params }) {
	let { user } = locals;
	if (user) {
    await post('/redeem', params, auth(cookies));
    throw redirect(307, `/${user.username}/dashboard`);
  } 

	throw redirect(307, '/login');
}